LPIC-2 Linux Professional Institute Certification Study Guide by Roderick W. Smith
Author:Roderick W. Smith
Language: eng
Format: epub
Publisher: Sybex
Published: 2011-04-05T16:00:00+00:00
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
The default table is filter, so omitting -t filter from this command produces the same output. The table summarized by this output is nearly empty; the FORWARD and OUTPUT chains have no rules, and the INPUT chain has just one rule—it drops all input from the 172.24.0.0/16 network. Although the format of information presented by iptables -L isn’t exactly equivalent to what you use when you create a rule, the similarities are strong enough that you should be able to interpret the output once you know how to create rules.
Setting the Default Policy
One critically important consideration when designing a firewall is the default policy, which is what the firewall does with packets that don’t match any rules in a chain. In fact, in the standard filter table, there are three default policies, one each for the INPUT, FORWARD, and OUTPUT chains. The default policy corresponds to an action that the system can take. Three options are common, as described in Table 7.7, although only two may be used as a default rule.
TABLE 7.7 Common firewall policies
Policy Description
ACCEPT An ACCEPT action causes the system to accept the packet and pass it on to the next chain or system. For instance, if the INPUT chain’s default policy is ACCEPT, any packet that doesn’t match a rule is passed to the target program (assuming one is using the specified port).
DROP This action causes the system to ignore the packet—to “drop it on the floor,” as it were. To the system that sends the packet (which could be a remote computer or a local program, depending on the chain involved), it appears that the packet was lost due to a routing error or the like.
REJECT This action is much like DROP, except that the kernel returns a code to the calling computer or program indicating that the packet has been rejected. This behavior is similar to what would happen if no program were using the target port. This action requires that you compile explicit support for it into the kernel, either in the main kernel file or as a module. Unfortunately, REJECT doesn’t work as a default policy, but you can use it as a target for more specific rules.
Typing iptables -L reveals the default policy, as shown in Listing 7.4—in that example, the INPUT and OUTPUT chains have a default policy of ACCEPT, whereas the FORWARD chain has a default policy of DROP. To change the default policy, you should first flush the chain of all its rules by passing the -F parameter and the chain name to iptables. You can then pass the -P parameter to iptables, along with the policy name. In both cases, you can optionally include -t and the table name:
# iptables -t filter -F FORWARD
# iptables -F INPUT
# iptables -P FORWARD DROP
# iptables -t filter -P INPUT DROP
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12644)
Hello! Python by Anthony Briggs(9947)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9822)
The Mikado Method by Ola Ellnestam Daniel Brolund(9813)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(9684)
Dependency Injection in .NET by Mark Seemann(9368)
Hit Refresh by Satya Nadella(8854)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8333)
The Kubernetes Operator Framework Book by Michael Dame(7920)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7810)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7788)
Grails in Action by Glen Smith Peter Ledbrook(7719)
Exploring Deepfakes by Bryan Lyon and Matt Tora(7708)
Practical Computer Architecture with Python and ARM by Alan Clements(7653)
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(7617)
Robo-Advisor with Python by Aki Ranin(7606)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7590)
Building Low Latency Applications with C++ by Sourav Ghosh(7490)
Svelte with Test-Driven Development by Daniel Irvine(7475)
